<template>
  <div class="create">
    <a href="javascript:;" class="iconfont icon-tianjia1" @click="isShowDialog = true"></a>
    <popup :visible.sync="isShowDialog">
      <div class="app-box">
        <div class="menu">
          <nav>
            <a
              v-for="(item, index) in settingMenu"
              :key="index"
              href="javascript:;"
              :class="{
                active: item.component == componentName
              }"
              @click="change(item)"
            >{{item.name}}</a>
          </nav>
        </div>
        <div class="content">
          <component :is="componentName" />
        </div>
      </div>
    </popup>
  </div>
</template>

<script>
export default {
  name: 'create',
  data () {
    return {
      isShowDialog: false,
      componentName: 'recommend-app',
      settingMenu: [
        {
          name: '推荐应用',
          component: 'recommend-app',
          icon: ''
        },
        {
          name: '自定义应用',
          component: 'custom-add',
          icon: ''
        }
      ]
    }
  },
  methods: {
    change (item) {
      this.componentName = item.component
    }
  }
}
</script>

<style lang="scss" scoped>
.create {
  .iconfont {
    font-size: 18px;
    color: #fff;
    margin-right: 20px;
  }
  .app-box {
    @include flex(row, center, center);
    height: 600px;
    .menu {
      width: 120px;
      height: 100%;
      background: #f2f2f2;
      nav {
        a {
          @include wh(100%, 40px);
          line-height: 40px;
          color: #666;
          font-size: 14px;
          padding: 0 20px;
          box-sizing: border-box;
          &.active {
            background: #f2f2f2;
            color: red;
          }
        }
      }
    }
    .content {
      height: 600px;
      flex: 1;
      background: #ffff;
    }
  }
}
</style>
